#include <stdio.h>
#include<stdlib.h>
#include<conio.h> 
#define random(x) (rand()%x)
int main()
{
	int i,j;
	int x=10,y=10;
	char input;
	int shoot=0;
	int target=1;
	int ny=7;
	int score=0;
	int round=0;
	while(round<27)
	{	
		int k=random(10);
		system("cls");
		if(target==1)
		{	
			for(i=0;i<ny;i++)
				printf(" ");
			printf("+\n"); 
		}
		else
		{
			printf("\n"); 
			if(round%5==0)
				ny=ny-k;
			else
				ny=ny+k;
			target=1;
		}
		if(shoot==0)
		{
			for(i=0;i<x;i++)
				printf("\n");
		} 
		else
		{
			for(i=0;i<x;i++)
			{
				for(j=0;j<y;j++)
					printf(" ");
				printf("|\n");			
			}
			if(y==ny)
			{
				target=0;
				score++;
			}	
			shoot=0;
		}
		round++;
		for(j=0;j<y;j++)
			printf(" ");
		printf("*\n");
		for(j=0;j<y-2;j++)
			printf(" ");
		printf("*****\n");
		for(j=0;j<y-1;j++)
			printf(" ");
		printf("* *\n");
		input=getch() ;
		if(input=='s')
			x++;
		if(input=='w')
			x--;
		if(input=='a')
			y--;
		if(input=='d')
			y++;
		if(input==' ')
			shoot=1; 
	}
	printf("得分：%d\n",score); 
	return 0;
}